home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-3139 / boot_pic.mug / install.s < prev    next >
Text File  |  1987-04-21  |  2KB  |  111 lines

  1. ;--------------------------------------------------
  2. ; Bootsector Installer by MUG U.K for personal use
  3. ;--------------------------------------------------
  4. ;
  5. ; Go to the end of this source code and press 'Alt' & 'I' to insert
  6. ; some new bootsector code
  7. ;
  8. ;
  9. * Ask which drive is to be protected
  10.  
  11. guard    pea    guardmess
  12.     move.w    #$09,-(sp)
  13.     trap    #1
  14.     addq.l    #6,sp
  15.         
  16. * Wait for the 'a', 'b' and 'esc' keys.
  17.  
  18. _kloop    move.w    #$07,-(sp)
  19.     trap    #1
  20.     addq.l    #2,sp
  21.     swap    d0
  22.     
  23.     cmp.b    #1,d0    ESC key
  24.     beq.s    _exit
  25.     cmp.b    #$1e,d0    'a' key
  26.     beq.s    guarda
  27.     cmp.b    #$30,d0    'b' key
  28.     bne.s    _kloop
  29.     
  30. guardb    move.w    #1,guarddrv+2
  31.     bra.s    do_guard
  32.     
  33. guarda    clr.w    guarddrv+2
  34.  
  35. do_guard    pea    guardclr    Display 'Writing'
  36.     move.w    #$09,-(sp)
  37.     trap    #1
  38.     addq.l    #6,sp
  39.         
  40. * Read the current bootsector and insert the main data into ours
  41.  
  42.     bsr.s    read
  43.         
  44.     move.w    #29,d0
  45.     lea    mybuffer,a1
  46.     lea    bootbuffer,a0
  47. cloop1    move.b    (a0)+,(a1)+
  48.     dbf    d0,cloop1
  49.     move.w    #$601c,mybuffer     ; Add BSR code
  50.         
  51. * Calculate new checksum
  52.  
  53.     lea    mybuffer,a0    My bootsector
  54.     clr.w    d7    Clear checksum count
  55.     clr.w    $1fe(a0)    In buffer as well
  56.     move.w    #$ff,d5
  57. calop    add.w    (a0)+,d7    Make checksum in D7
  58.     dbf    d5,calop
  59.     move.w    #$1234,d0
  60.     sub.w    d7,d0
  61.     move.w    d0,$1fe+mybuffer
  62.     
  63.     bsr.s    write
  64.     
  65.     bra    guard
  66.     
  67. _exit    clr.w    -(sp)
  68.     trap    #1
  69.  
  70. * Subroutines to read and write the bootsector
  71.  
  72. read    move.w    #$08,d0
  73.     lea    bootbuffer,a0
  74.     bra.s    perform
  75. write    move.w    #$09,d0
  76.     lea    mybuffer,a0
  77. perform    move.w    #$01,-(sp)    Read 1 sector
  78.     clr.w    -(sp)    Side 0
  79.     clr.w    -(sp)    Track 0
  80.     move.w    #$01,-(sp)    Sector 1
  81. guarddrv    move.w    #0,-(sp)    Drive A
  82.     clr.l    -(sp)    Filler
  83.     move.l    a0,-(sp)    Address of buffer
  84.     move.w    d0,-(sp)    Floprd/flopwr
  85.     trap    #14
  86.     add.l    #20,sp
  87.     rts
  88.         
  89. guardmess    dc.b    27,"EInsert Disk To Be Installed.",13,10,10
  90.     dc.b    "Press 'A' to write to the disk in drive A",13,10
  91.     dc.b    "      'B' to write to the disk in drive B",13,10
  92.     dc.b    "     'ESC' to abort.",0
  93. guardclr    dc.b    13,10,10,10
  94.     dc.b    "Writing ... Please Wait",0
  95.         
  96.     even
  97.     
  98. * 512 byte buffer for bootsector read from disk
  99.     
  100. bootbuffer    ds.b    512
  101.  
  102. * Pre constructed boot sector minus statistics
  103.  
  104. bootst
  105. mybuffer    ds.b    30
  106.  
  107. * Insert the bootsector source of your choice after 'bootcode'
  108.  
  109. bootcode
  110.  
  111.